﻿<UserControl x:Class="Tododoo.Views.ShellView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ScrollViewer Grid.Row="0">
            <ListBox ItemsSource="{Binding Things}" HorizontalContentAlignment="Stretch" Padding="0" BorderThickness="0">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Margin" Value="0" />
                        <Setter Property="Padding" Value="0" />
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border x:Name="border" Background="White">
                            <Grid Margin="5, 3" Height="25">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="30" />
                                </Grid.ColumnDefinitions>
                                <CheckBox IsChecked="{Binding Done}"
                                          Content="{Binding Name}" VerticalAlignment="Center" />
                                <!--<WrapPanel Grid.Column="1" VerticalAlignment="Center">
                                    <TextBlock Text="{Binding Created, StringFormat=g}" VerticalAlignment="Center" />
                                </WrapPanel>-->
                                <Button x:Name="buttonDelete" Visibility="Collapsed" IsEnabled="False" Grid.Column="2">
                                    <Image Source="pack://application:,,,/Icons/delete.png" Stretch="None" />
                                </Button>
                            </Grid>
                        </Border>
                        <DataTemplate.Triggers>
                            <Trigger Property="IsMouseOver"
                                     Value="True">
                                <Setter TargetName="border"
                                        Property="Background"
                                        Value="#DDDDDD" />
                                <Setter TargetName="buttonDelete"
                                        Property="Visibility"
                                        Value="Visible" />
                                <Setter TargetName="buttonDelete"
                                        Property="IsEnabled"
                                        Value="True" />
                            </Trigger>
                            <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}}" Value="True">
                                <Setter TargetName="border"
                                        Property="Background"
                                        Value="#DDDDDD" />
                                <Setter TargetName="buttonDelete"
                                        Property="Visibility"
                                        Value="Visible" />
                                <Setter TargetName="buttonDelete"
                                        Property="IsEnabled"
                                        Value="True" />
                            </DataTrigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </ScrollViewer>
        <Border BorderThickness="0,1,0,0" BorderBrush="#666666" Grid.Row="1">
            <WrapPanel>
                <Button BorderThickness="0" Margin="0">
                    <Image Source="pack://application:,,,/Icons/add.png" Stretch="None" />
                </Button>
                <Button BorderThickness="0" Margin="0">
                    <Image Source="pack://application:,,,/Icons/cog.png" Stretch="None" />
                </Button>
            </WrapPanel>
        </Border>
    </Grid>
</UserControl>
